// Package base_linear_table 283-remove-zero
// @Title base_linear_table
// @Description
// @Author  == 琳琳也叫王木木 ==  2021-12-15 18:05
// @Create  2021-12-15 18:05
package base_linear_table

import "fmt"

// 使用双指针
func moveZeroes(nums []int) {
	j := 0
	for i := 0; i < len(nums); i++ {
		if nums[i] != 0 {
			nums[j] = nums[i]
			j++
		}
	}
	for i := j; i < len(nums); i++ {
		nums[i] = 0
	}
	fmt.Println(nums)
}

func Code283() {
	moveZeroes([]int{0, 1, 0, 3, 12})
}
